<xsl:stylesheet version="1.0" xmlns="urn:hl7-org:v3" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<xsl:output method="xml" indent="yes"/>
	<xsl:include href="CDA-Support-Files/CDAHeader.xsl"/>
	<xsl:include href="CDA-Support-Files/PatientInformation.xsl"/>
	<xsl:include href="CDA-Support-Files/Location.xsl"/>
	<xsl:template match="/Document">
		<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
			
			<realmCode code="CN"/>
			<typeId root="2.16.840.1.113883.1.3" extension="POCD_MT000040"/>
			<templateId root="2.16.156.10011.2.1.1.29"/>
			<!-- 文档流水号 -->
			<xsl:call-template name="DocumentNo"/>
			<title>中医住院病案首页</title>
			<!-- 文档机器生成时间 -->
			<xsl:call-template name="effectiveTime"/>
			<xsl:call-template name="Confidentiality"/>
			<xsl:call-template name="languageCode"/>
			<setId/>
			<versionNumber/>
			<!--文档记录对象（患者）-->
			<recordTarget typeCode="RCT" contextControlCode="OP">
				<patientRole classCode="PAT">
					<!-- 健康卡号 -->
					<xsl:apply-templates select="Header/recordTarget/healthCardId" mode="HealthCardNumber"/>
					<!-- 住院号标识 todo-->
					<xsl:apply-templates select="Header/recordTarget/inpatientNum" mode="inpatientNum"/>
					<!-- 病案号标识 todo-->
					<xsl:apply-templates select="Header/recordTarget/MRN" mode="MPIID"/>
					<!-- 现住址 -->
					<xsl:apply-templates select="Header/recordTarget/addr" mode="Address"/>
					<xsl:apply-templates select="Header/recordTarget/telcom" mode="PhoneNumber"/>
					<patient classCode="PSN" determinerCode="INSTANCE">
						<!--患者身份证号码，必选-->
						<xsl:apply-templates select="Header/recordTarget/patient/patientId" mode="nationalIdNumber"/>						
						<!--门诊号-->
						<xsl:apply-templates select="Header/recordTarget/patient/outpatientNum" mode="outpatientNum"/>
						<!--住院号-->
						<xsl:apply-templates select="Header/recordTarget/patient/inpatientNum" mode="inpatientNum"/>
						<!--电子申请单号-->
						<xsl:apply-templates select="Header/recordTarget/patient/MRN" mode="MRN"/>
						<!--患者姓名，必选-->
						<xsl:apply-templates select="Header/recordTarget/patient/patientName" mode="Name"/>
						<!-- 性别，必选 -->
						<xsl:apply-templates select="Header/recordTarget/patient/administrativeGender" mode="Gender"/>
						<!-- 出生时间1..1 -->
						<birthTime value="{Value}"/>
						<!-- 婚姻状况1..1 -->
						<xsl:apply-templates select="Header/recordTarget/patient/maritalStatusCode" mode="MaritalStatus"/>
						<!-- 民族1..1 -->
						<xsl:apply-templates select="Header/recordTarget/patient/ethnicGroupCode" mode="EthnicGroup"/>
						<!-- 出生地 -->
						<birthplace>
							<place >
								<addr>
									<county>
										<xsl:value-of select="county/Value"/>
									</county>
									<city>
										<xsl:value-of select="city/Value"/>
									</city>
									<state>
										<xsl:value-of select="state/Value"/>
									</state>
									<postalCode>
										<xsl:value-of select="postCode/Value"/>
									</postalCode>
								</addr>
							</place>
						</birthplace>
						<!-- 国籍 -->
						<xsl:apply-templates select="Header/recordTarget/patient/nationality" mode="nationality"/>
						<!-- 年龄 -->
						<xsl:apply-templates select="Header/recordTarget/patient/ageInYear" mode="Age"/>
						<!-- 工作单位 -->
						<xsl:apply-templates select="Header/recordTarget/patient/employer" mode="EmployerWithAddr"/>
						<!-- 户口信息 -->
						<xsl:apply-templates select="Header/recordTarget/patient/household" mode="household"/>
						<!-- 籍贯信息 -->
						<xsl:apply-templates select="Header/recordTarget/patient/nativePlace" mode="nativePlace"/>
						<!--职业状况-->
						<xsl:apply-templates select="Header/recordTarget/patient/occupationCode" mode="Occupation1"/>
					</patient>
					<!--提供患者服务机构-->
					<providerOrganization classCode="ORG" determinerCode="INSTANCE">
						<!--科室标识-->
						<id root="2.16.156.10011.1.5" extension="{providerDeptId/Value}"/>
						<!--科室名称-->
						<name>
							<xsl:value-of select="providerDeptName/Value"/>
						</name>
					</providerOrganization>
				</patientRole>
			</recordTarget>
			<!-- 文档创作者 -->
			<xsl:apply-templates select="Header/author" mode="AuthorNoOrganization"/>
			<!-- 保管机构-数据录入者信息 -->
			<xsl:apply-templates select="Header/custodian" mode="Custodian"/>			
			<!-- LegalAuthenticator签名 -->
			<xsl:for-each select="Header/LegalAuthenticators/LegalAuthenticator">
				<xsl:if test="assignedEntityCode = '科主任'">
					<xsl:comment><xsl:value-of select="assignedEntityCode"/>签名</xsl:comment>
					<legalAuthenticator>
						<time/>
						<signatureCode/>
						<assignedEntity>
							<id root="2.16.156.10011.1.4" extension="{assignedEntityId}"/>
							<code displayName="{assignedEntityCode}"/>
							<assignedPerson classCode="PSN" determinerCode="INSTANCE">
								<name>
									<xsl:value-of select="assignedPersonName/Display"/>
								</name>
							</assignedPerson>
						</assignedEntity>
					</legalAuthenticator>
				</xsl:if>
			</xsl:for-each>
			<!-- Authenticator签名 -->
			<xsl:for-each select="Header/Authenticators/Authenticator">
				<xsl:if test="assignedEntityCode = '主任(副主任)' or assignedEntityCode = '主治医师' or assignedEntityCode = '责任护士' or assignedEntityCode = '进修医师' or assignedEntityCode='实习医师' or assignedEntityCode='住院医师' or assignedEntityCode='编码员'">
					<xsl:comment><xsl:value-of select="assignedEntityCode"/>签名</xsl:comment>
					<authenticator>
						<time/>
						<signatureCode/>
						<assignedEntity>
							<id root="2.16.156.10011.1.4" extension="{assignedEntityId}"/>
							<code displayName="{assignedEntityCode}"/>
							<assignedPerson classCode="PSN" determinerCode="INSTANCE">
								<name>
									<xsl:value-of select="assignedPersonName/Display"/>
								</name>
							</assignedPerson>
						</assignedEntity>
					</authenticator>
				</xsl:if>
			</xsl:for-each>
			
			<!-- 检验申请机构及科室 -->
			<xsl:for-each select="Header/Participants/Participant">
				<xsl:if test="typeCode = 'NOT'">
					<xsl:comment>检验申请机构及科室</xsl:comment>
					<participant typeCode="NOT"> 
						<!--联系人@classCode：CON，固定值，表示角色是联系人 -->  
						<associatedEntity classCode="ECON"> 
							<!--联系人类别，表示与患者之间的关系-->  
							<code code="{associatedEntityCode/Value}" codeSystem="2.16.156.10011.2.3.3.8" codeSystemName="家庭关系代码表(GB/T 4761)" displayName="{associatedEntityCode/Display}"/>  
							<!--联系人地址-->  
							<xsl:apply-templates select="addr" mode="Address"/> 
							<!--电话号码-->  
							<telecom use="H" value="{telcom/Value}"/>  
							<!--联系人-->  
							<associatedPerson classCode="PSN" determinerCode="INSTANCE"> 
								<!--姓名-->  
								<name><xsl:value-of select="wholeOrganization/Display"/></name> 
							</associatedPerson> 
						</associatedEntity> 
					</participant>  
				</xsl:if>
				
			</xsl:for-each>
			<!--关联活动信息-->
			<xsl:apply-templates select="Header/RelatedDocuments/RelatedDocument" mode="relatedDocument1"/>
			<!--文档中医疗卫生事件的就诊场景,即入院场景记录-->
			<componentOf typeCode="COMP">
				<xsl:apply-templates select="Header/encompassingEncounter" mode="EncompassingEncounter0032"/>
			</componentOf>
			<!--****************************文档体Body********************-->
			
		
			
			<!--****************************文档体Body********************-->
			<component>
				<structuredBody>
					<!--
********************************************************
生命体征章节
********************************************************
-->
					<component>
						<section>
							<code code="8716-3" displayName="VITAL SIGNS" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
							<text/>
							<xsl:apply-templates select="VitalSigns"/>
						</section>
					</component>
					<!--
********************************************************
诊断章节
********************************************************
-->
					<xsl:apply-templates select="Diagnosis"/>
					<!--
********************************************************
主要健康问题章节
********************************************************
-->
					<component>
						<section>
							<code code="11450-4" displayName="PROBLEM LIST" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
							<text/>
							<xsl:apply-templates select="Problem"/>
						</section>
					</component>
					<!--
********************************************************
转科记录章节
********************************************************
-->
					<component>
						<section>
							<code code="42349-1" displayName="REASON FOR REFERRAL" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
							<text/>
							<!--转科条目-->
							<entry>
								<observation classCode="OBS" moodCode="EVN">
									<code/>
									<value xsi:type="ST"><xsl:value-of select="Referral/referralTarget/Value"/></value>
									<author>
										<time/>
										<assignedAuthor>
											<id/>
											<representedOrganization>
												<name/>
											</representedOrganization>
										</assignedAuthor>
									</author>
								</observation>
							</entry>
						</section>
					</component>
					<!--
********************************************************
出院诊断章节
********************************************************
-->
					<component>
						<section>
							<code code="11535-2" displayName="Discharge Diagnosis" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
							<text/>
							<!--出院中医诊断-主病-->
							<xsl:apply-templates select="DisDiag/TCM/TCM[TCMdiag/code/Value]"/>
							<!--出院中医诊断-主证-->
							<xsl:apply-templates select="DisDiag/TCMSyndrome/TCMSyndrome[syndrome/code/Value]"/>
							<!--出院诊断-主要诊断条目-->
							<xsl:apply-templates select="DisDiag/Primarys/Primary[diag/code/Value]"/>
							<xsl:apply-templates select="DisDiag/Others/Other[diag/code/Value]"/>
							<!--离院方式-->
							<entry typeCode="COMP">
								<observation classCode="OBS" moodCode="EVN">
									<code code="DE06.00.223.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="离院方式"/>
									<value xsi:type="CD" code="{DisDiag/dischargeDisposition/Value}" displayName="{DisDiag/dischargeDisposition/Display}" codeSystem="2.16.156.10011.2.3.1.265" codeSystemName="离院方式代码表"/>
									</observation>
							</entry>
							<!--拟接受医疗机构名称-->
							<entry>
								<observation classCode="OBS" moodCode="EVN">
									<code code="DE08.10.013.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="拟接收医疗机构名称"/>
									<value xsi:type="ST">
										<xsl:value-of select="DisDiag/receivingOrganization/Value"/>
									</value>
								</observation>
							</entry>
						</section>
					</component>
					<!--
********************************************************
过敏史章节
********************************************************
-->
					<component>
						<section>
							<code code="48765-2" displayName="Allergies, adverse reactions, alerts" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
							<text/>
							<entry typeCode="DRIV">
								<act classCode="ACT" moodCode="EVN">
									<code/>
									<entryRelationship typeCode="SUBJ">
										<observation classCode="OBS" moodCode="EVN">
											<code code="DE02.10.023.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="药物过敏标志"/>
											<value xsi:type="BL" value="true"/>
											<participant typeCode="CSM">
												<participantRole classCode="MANU">
													<playingEntity classCode="MMAT">
														<!--住院患者过敏源-->
														<code code="DE02.10.022.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="过敏药物"/>
														<desc xsi:type="ST">
															<xsl:value-of select="Header/Allergies/Allergy/Value/Display"/>
														</desc>
													</playingEntity>
												</participantRole>
											</participant>
										</observation>
									</entryRelationship>
								</act>
							</entry>
						</section>
					</component>
					<!--
********************************************************
实验室检查章节
********************************************************
-->
					<component>
						<section>
							<code code="30954-2" displayName="STUDIES SUMMARY" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
							<text/>
							<entry typeCode="COMP">
								<!-- 血型-->
								<organizer classCode="BATTERY" moodCode="EVN">
									<statusCode/>
									<component typeCode="COMP">
										<!-- ABO血型 -->
										<observation classCode="OBS" moodCode="EVN">
											<code code="DE04.50.001.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="ABO血型代码"/>
											<value xsi:type="CD" code="1" codeSystem="2.16.156.10011.2.3.1.85" codeSystemName="ABO血型代码表" displayName="A型"/>
										</observation>
									</component>
									<component typeCode="COMP">
										<!-- Rh血型 -->
										<observation classCode="OBS" moodCode="EVN">
											<code code="DE04.50.010.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="Rh血型代码表"/>
											<value xsi:type="CD" code="2" codeSystem="2.16.156.10011.2.3.1.250" codeSystemName="Rh(D)血型代码表" displayName="阳性"/>
										</observation>
									</component>
								</organizer>
							</entry>
						</section>
					</component>
					<!--
********************************************************
手术操作章节
********************************************************
-->
					<xsl:apply-templates select="Procedure/Items/ProcedureItem[1]"/>
					<!--
*******************************************************
住院史章节
*******************************************************
-->
					<component>
						<section>
							<code code="11336-5" codeSystem="2.16.840.1.113883.6.1" displayName="HISTORY OF HOSPITALIZATIONS" codeSystemName="LOINC"/>
							<text/>
							<!--住院次数 -->
							<entry typeCode="COMP">
								<observation classCode="OBS" moodCode="EVN">
									<code code="DE02.10.090.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="住院次数"/>
									<value xsi:type="PQ" value="{Hospitalization/hospitalizationCount/Value}"/>
								</observation>
							</entry>
						</section>
					</component>
					<!--
*******************************************************
住院过程章节
*******************************************************
-->
					<component>
						<section>
							<code code="8648-8" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Hospital Course"/>
							<text/>
							<!--实际住院天数 -->
							<entry typeCode="COMP">
								<observation classCode="OBS" moodCode="EVN">
									<code code="DE06.00.310.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="实际住院天数"/>
									<value xsi:type="PQ" value="{HospitalCourse/stayDays/Value}" unit="天"/>
								</observation>
							</entry>
							<entry>
								<!--出院科室及病房 -->
								<act classCode="ACT" moodCode="EVN">
									<code/>
									<author>
										<id root="2.16.156.10011.1.21" extension="567"/>
										<time/>
										<assignedAuthor>
											<id root="2.16.156.10011.1.21" extension="567"/>
											<representedOrganization>
												<!--住院患者出院病房、科室名称-->
												<id root="2.16.156.10011.1.21" extension="567"/>
												<name>
													<xsl:value-of select="HospitalCourse/dischargeWard/Value"/>
												</name>
												<asOrganizationPartOf classCode="PART">
													<wholeOrganization classCode="ORG" determinerCode="INSTANCE">
														<id root="2.16.156.10011.1.26" extension="567"/>
														<name>
															<xsl:value-of select="HospitalCourse/dischargeDepartment/Value"/>
														</name>
													</wholeOrganization>
												</asOrganizationPartOf>
											</representedOrganization>
										</assignedAuthor>
									</author>
								</act>
							</entry>
						</section>
					</component>
					<!--
********************************************************
行政管理章节
********************************************************
-->
					<component>
						<section>
							<code displayName="行政管理"/>
							<text/>
							<!--亡患者尸检标志-->
							<entry typeCode="COMP">
								<observation classCode="OBS" moodCode="EVN">
									<code code="DE09.00.108.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="死亡患者尸检标志"/>
									<value xsi:type="BL" value="{Administration/autospy/Value}"/>
								</observation>
							</entry>
							<!--病案质量-->
							<entry>
								<observation classCode="OBS" moodCode="EVN">
									<code code="DE09.00.103.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="病案质量"/>
									<!-- 质控日期 -->
									<effectiveTime value="20120109"/>
									<value xsi:type="CD" code="{Administration/MRQuality/Value}" displayName="{Administration/MRQuality/Display}" codeSystem="2.16.156.10011.2.3.2.29" codeSystemName="病案质量等级表"/>
									<author>
										<time/>
										<assignedAuthor>
											<id root="2.16.156.10011.1.4" extension="医务人员编码"/>
											<code displayName="质控医生"/>
											<assignedPerson>
												<name>
													<xsl:value-of select="Administration/QCDocter/Display"/>
												</name>
											</assignedPerson>
										</assignedAuthor>
									</author>
									<author>
										<time/>
										<assignedAuthor>
											<id root="2.16.156.10011.1.4" extension="医务人员编码"/>
											<code displayName="质控护士"/>
											<assignedPerson>
												<name>
													<xsl:value-of select="Administration/QCNurse/Display"/>
												</name>
											</assignedPerson>
										</assignedAuthor>
									</author>
								</observation>
							</entry>
						</section>
					</component>
					<!--
***********************************************
治疗计划章节
***********************************************
-->
					<component>
						<section>
							<code code="18776-5" displayName="TREATMENT PLAN" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
							<text/>
							<!-- 有否出院31天内再住院计划 -->
							<entry>
								<observation classCode="OBS" moodCode="EVN">
									<code code="DE06.00.194.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院31天内再住院标志"/>
									<value xsi:type="BL" value="{TreatmentPlan/readmission/Value}"/>
									<entryRelationship typeCode="GEVL" negationInd="FALSE">
										<observation classCode="OBS" moodCode="EVN">
											<code code="DE06.00.195.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院31天内再住院目的"/>
											<value xsi:type="ST">
												<xsl:value-of select="TreatmentPlan/readmissionReason/Value"/>
											</value>
										</observation>
									</entryRelationship>
								</observation>
							</entry>
						</section>
					</component>
					<!--
********************************************************
费用章节
********************************************************
-->
					<xsl:apply-templates select="Payment"/>
				</structuredBody>
			</component>
		</ClinicalDocument>
	</xsl:template>
	
	
	
	<xsl:template match="VitalSigns">
		<xsl:apply-templates select="VitalSign[display='新生儿入院体重']"></xsl:apply-templates>
		<xsl:apply-templates select="VitalSign[display='新生儿出生体重']"></xsl:apply-templates>
	</xsl:template>
	<xsl:template match="VitalSign[display='新生儿入院体重']">
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE04.10.019.00" displayName="入院体重" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
				<value xsi:type="PQ" value="{value}" unit="g"/>
			</observation>
		</entry>
	</xsl:template>
	<xsl:template match="VitalSign[display='新生儿出生体重']">
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE04.10.019.00" displayName="新生儿出生体重（g）" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"/>
				<value xsi:type="PQ" value="3500" unit="g"/>
			</observation>
		</entry>
	</xsl:template>
	<xsl:template match="Diagnosis">
		<component>
			<section>
				<code code="29548-5" displayName="Diagnosis" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
				<text/>
				<!--门（急）诊诊断-中医诊断条目-->
				<xsl:apply-templates select="TCM/TCM[TCMdiag/code/Value]"></xsl:apply-templates>
				<!--门（急）诊诊断-中医诊断症候条目-->
				<xsl:apply-templates select="TCMSyndrome/TCMSyndrome[syndrome/code/Value]"></xsl:apply-templates>
				<!--门（急）诊诊断-西医诊断条目-->
				<xsl:apply-templates select="Westerns/Western[diag/code/Value]"></xsl:apply-templates>
				<!--病理诊断-疾病名称-->
				<xsl:apply-templates select="Pathologys/Pathology[diag/code/Value]"></xsl:apply-templates>
			</section>
		</component>
	</xsl:template>
	<xsl:template match="TCM/TCM[TCMdiag/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<xsl:if test="TCMdiag/code/Display">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.10.172.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="门（急）诊诊断（中医诊断）名称">
								<qualifier>
									<name displayName="中医诊断名称"/>
								</qualifier>
							</code>
							<value xsi:type="ST"><xsl:value-of select="TCMdiag/code/Display"/></value>
						</observation>
					</component>
				</xsl:if>
				<xsl:if test="TCMdiag/code/Value">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.10.130.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="门（急）诊诊断（中医诊断）病名编码">
								<qualifier>
									<name displayName="中医诊断代码"/>
								</qualifier>
							</code>
							<value xsi:type="CD" code="{TCMdiag/code/Value}" codeSystem="2.16.156.10011.2.3.3.14" codeSystemName="中医病证分类与代码表( GB/T 15657)">
								<xsl:if test="TCMdiag/code/Display">
									<xsl:attribute name="displayName"><xsl:value-of select="TCMdiag/code/Display"/></xsl:attribute>
								</xsl:if>
							</value>
						</observation>
					</component>
				</xsl:if>
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="TCMSyndrome/TCMSyndrome[syndrome/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<xsl:if test="syndrome/code/Display">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.10.172.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="门（急）诊诊断（中医证候）名称">
								<qualifier>
									<name displayName="中医证候名称"/>
								</qualifier>
							</code>
							<value xsi:type="ST"><xsl:value-of select="syndrome/code/Display"/></value>
						</observation>
					</component>
				</xsl:if>
				<xsl:if test="syndrome/code/Value">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.10.130.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="门（急）诊诊断（中医证候）证候编码">
								<qualifier>
									<name displayName="中医证候代码"/>
								</qualifier>
							</code>
							<value xsi:type="CD" code="{syndrome/code/Value}" codeSystem="2.16.156.10011.2.3.3.14" codeSystemName="中医病证分类与代码表( GB/T 15657)">
								<xsl:if test="syndrome/code/Display">
									<xsl:attribute name="displayName"><xsl:value-of select="syndrome/code/Display"/></xsl:attribute>
								</xsl:if>
							</value>
						</observation>
					</component>
				</xsl:if>
				
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="Westerns/Western[diag/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<xsl:if test="diag/code/Display">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.01.025.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="门（急）诊诊断（西医诊断）名称">
								<qualifier>
									<name displayName="西医诊断名称"/>
								</qualifier>
							</code>
							<value xsi:type="ST"><xsl:value-of select="diag/code/Display"/></value>
						</observation>
					</component>
				</xsl:if>
				<xsl:if test="diag/code/Value">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.01.024.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="门（急）诊诊断（西医诊断）疾病编码">
								<qualifier>
									<name displayName="西医诊断代码"/>
								</qualifier>
							</code>
							<value xsi:type="CD" code="{diag/code/Value}"   codeSystem="2.16.156.10011.2.3.3.11.5" codeSystemName="ICD-10">
								<xsl:if test="diag/code/Display">
									<xsl:attribute name="displayName"><xsl:value-of select="diag/code/Display"/></xsl:attribute>
								</xsl:if>
							</value>
						</observation>
					</component>
				</xsl:if>
				
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="Pathologys/Pathology[diag/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<!-- 病理号标识 -->
						<id root="2.16.156.10011.1.8" extension="-"/>
						<code code="DE05.01.025.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="病理诊断名称">
							<qualifier>
								<name displayName="病理诊断名称"/>
							</qualifier>
						</code>
						<value xsi:type="ST">
							<xsl:value-of select="diag/code/Display"/>
						</value>
					</observation>
				</component>
				<xsl:if test="diag/code/Value">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.01.024.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="病理诊断编码">
								<qualifier>
									<name displayName="病理诊断代码"/>
								</qualifier>
							</code>
							<value xsi:type="CD" code="{diag/code/Value}" displayName="{diag/code/Display}" codeSystem="2.16.156.10011.2.3.3.11.5" codeSystemName="ICD-10"/>
						</observation>
					</component>
				</xsl:if>
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="Problem">
		<!--治疗类别-->
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE06.00.304.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="治疗类别代码"/>
				<value xsi:type="CD" code="{treatmenType/Value}" codeSystem="2.16.156.10011.2.3.1.264" codeSystemName="治疗类别代码表" displayName="{treatmenType/Display}"/>
			</observation>
		</entry>
		<!--实施临床路径 -->
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE06.00.247.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="实施临床路径"/>
				<value xsi:type="CD" code="{clinicalPathway/Value}" codeSystem="2.16.156.10011.2.3.2.57" codeSystemName="实施临床路径标志代码表" displayName="{clinicalPathway/Display}"/>
			</observation>
		</entry>
		<!--住院者疾病状态代码-->
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE05.10.119.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="住院者疾病状态代码"/>
				<value xsi:type="CD" code="1" codeSystem="2.16.156.10011.2.3.1.100" codeSystemName="住院者疾病状态代码表" displayName="未知"/>
			</observation>
		</entry>
		<!--住院患者损伤和中毒外部原因-->
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE05.10.152.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="患者损伤和中毒外部原因"/>
				<value xsi:type="ST" />
				<entryRelationship typeCode="REFR" negationInd="FALSE">
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.01.078.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="患者损伤和中毒外部原因-疾病编码"/>
						<value xsi:type="CD" codeSystemName="ICD-10" codeSystem="2.16.156.10011.2.3.3.11.5" displayName="{damageDiag/Display}" code="{damageDiag/Value}">
							<xsl:value-of select="name/Value"/>
						</value>
					</observation>
				</entryRelationship>
			</observation>
		</entry>
		<xsl:apply-templates select="comaBeforeAdmit"></xsl:apply-templates>
		<xsl:apply-templates select="comaAfterAdmit"></xsl:apply-templates>
	</xsl:template>
	<xsl:template match="comaBeforeAdmit">
		<entry typeCode="COMP">
			<organizer classCode="CLUSTER" moodCode="EVN">
				<!--<code displayName="颅脑损伤患者入院前昏迷时间"/> -->
				<statusCode/>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.10.138.01" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="颅脑损伤患者入 院前昏迷时间-d"/>
						<value xsi:type="PQ" unit="d" value="{days/Value}"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.10.138.02" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="颅脑损伤患者入院前昏迷时间-h"/>
						<value xsi:type="PQ" unit="h" value="{hours/Value}"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.10.138.03" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="颅脑损伤患者入院前昏迷时间-min"/>
						<value xsi:type="PQ" unit="min" value="{minutes/Value}"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="comaAfterAdmit">
		<!--颅脑损伤患者入院后昏迷时间-->
		<entry typeCode="COMP">
			<organizer classCode="CLUSTER" moodCode="EVN">
				<code displayName="颅脑损伤患者入院后昏迷时间"/>
				<statusCode/>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.10.138.01" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="颅脑损伤患者入
							院后昏迷时间-d"/>
						<value xsi:type="PQ" unit="d" value="{days/Value}"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.10.138.02" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="颅脑损伤患者入
							院后昏迷时间-h"/>
						<value xsi:type="PQ" unit="h" value="{hours/Value}"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.10.138.03" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="颅脑损伤患者入
							院后昏迷时间-min"/>
						<value xsi:type="PQ" unit="min" value="{minutes/Value}"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<!--出院中医主证诊断条目-->
	<xsl:template match="DisDiag/TCMSyndrome/TCMSyndrome[syndrome/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<xsl:if test="syndrome/code/Display">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.10.172.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主证名称">
								<qualifier>
									<name displayName="主证名称"/>
								</qualifier>
							</code>
							<value xsi:type="ST"><xsl:value-of select="syndrome/code/Display"/></value>
						</observation>
					</component>
				</xsl:if>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<!--住院患者疾病中医诊断主证编码-->
						<code code="DE05.10.130.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主证代码">
							<qualifier>
								<name displayName="主证代码"/>
							</qualifier>
						</code>
						<!--中医诊断代码/疾病诊断名称-->
						<value xsi:type="CD" code="{syndrome/code/Value}" displayName="{syndrome/code/Display}" codeSystem="2.16.156.10011.2.3.3.14" codeSystemName="中医病证分类与代码表( GB/T 15657)"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE09.00.104.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主证-入院病情代码">
							<qualifier>
								<name displayName="中医主证入院病情"/>
							</qualifier>
						</code>
						<value xsi:type="CD" code="{syndrome/sickCondition/Value}" displayName="{syndrome/sickCondition/Display}" codeSystem="2.16.156.10011.2.3.1.253" codeSystemName="入院病情代码表"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<!--出院中医诊断-主病-->
	<xsl:template match="DisDiag/TCM/TCM[TCMdiag/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.10.172.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主病名称">
							<qualifier>
								<name displayName="主病名称"/>
							</qualifier>
						</code>
						<value xsi:type="ST"><xsl:value-of select="TCMdiag/code/Display"/></value>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<!--住院患者疾病中医诊断主病编码-->
						<code code="DE05.10.130.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主病编码">
							<qualifier>
								<name displayName="主病代码"/>
							</qualifier>
						</code>
						<value xsi:type="CD"  code="{TCMdiag/code/Value}" displayName="{TCMdiag/code/Display}" codeSystem="2.16.156.10011.2.3.3.14" codeSystemName="中医病证分类与代码表( GB/T 15657)"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE09.00.104.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主病-入院病情代码">
							<qualifier>
								<name displayName="中医主病入院病情"/>
							</qualifier>
						</code>
						<value xsi:type="CD" code="{sickCondition/Value}" displayName="{sickCondition/Display}" codeSystem="2.16.156.10011.2.3.1.253" codeSystemName="入院病情代码表"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<!--出院中医诊断-主证-->
	<xsl:template match="DisDiag/TCMSyndrome/TCMSyndrome[syndrome/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE05.10.172.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主证名称">
							<qualifier>
								<name displayName="主证名称"/>
							</qualifier>
						</code>
						<value xsi:type="ST"><xsl:value-of select="syndrome/code/Display"/></value>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<!--住院患者疾病中医诊断主证编码-->
						<code code="DE05.10.130.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主证代码">
							<qualifier>
								<name displayName="主证代码"/>
							</qualifier>
						</code>
						<!--中医诊断代码/疾病诊断名称-->
						<value xsi:type="CD" code="{syndrome/code/Value}" displayName="{syndrome/code/Display}" codeSystem="2.16.156.10011.2.3.3.14" codeSystemName="中医病证分类与代码表( GB/T 15657)"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE09.00.104.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院中医诊断-主证-入院病情代码">
							<qualifier>
								<name displayName="中医主证入院病情"/>
							</qualifier>
						</code>
						<value xsi:type="CD" code="{sickCondition/Value}" displayName="{sickCondition/Display}" codeSystem="2.16.156.10011.2.3.1.253" codeSystemName="入院病情代码表"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="DisDiag/Primarys/Primary[diag/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<xsl:if test="diag/code/Display">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.01.025.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院西医诊断-主要诊断-疾病名称">
								<qualifier>
									<name displayName="主要诊断-疾病名称"/>
								</qualifier>
							</code>
							<!--确诊日期-->
							<value xsi:type="ST"><xsl:value-of select="diag/code/Display"/></value>
						</observation>
					</component>
				</xsl:if>
				<xsl:if test="diag/code/Value">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<!--住院患者疾病诊断类型-代码/住院患者疾病诊断类型-详细描
述-->
							<code code="DE05.01.024.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="西医出院诊断-主要诊断-疾病编码">
								<qualifier>
									<name displayName="主要诊断疾病编码"/>
								</qualifier>
							</code>
							<!--疾病诊断代码/疾病诊断名称-->
							<value xsi:type="CD" code="{diag/code/Value}" displayName="{diag/code/Display}" codeSystem="2.16.156.10011.2.3.3.11.3" codeSystemName="ICD-10"/>
						</observation>
					</component>
				</xsl:if>
				<xsl:if test="sickCondition/Value">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE09.00.104.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院西医诊断-主要诊断-入院病情代码">
								<qualifier>
									<name displayName="主要诊断-入院病情代码"/>
								</qualifier>
							</code>
							<value xsi:type="CD" code="{sickCondition/Value}" displayName="{sickCondition/Display}" codeSystem="2.16.156.10011.2.3.1.253" codeSystemName="入院病情代码表"/>
						</observation>
					</component>
				</xsl:if>
				
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="DisDiag/Others/Other[diag/code/Value]">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<xsl:if test="diag/code/Display">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<code code="DE05.01.025.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院西医诊断-其他诊断名称">
								<qualifier>
									<name displayName="其他诊断名称"/>
								</qualifier>
							</code>
							<!--确诊日期-->
	
							<value xsi:type="ST"><xsl:value-of select="diag/code/Display"/></value>
						</observation>
					</component>
				</xsl:if>
				<xsl:if test="diag/code/Value">
					<component>
						<observation classCode="OBS" moodCode="EVN">
							<!--住院患者疾病诊断类型-代码/住院患者疾病诊断类型-详细描
述-->
							<code code="DE05.01.024.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="西医出院诊断-其他诊断疾病编码">
								<qualifier>
									<name displayName="其他诊断疾病编码"/>
								</qualifier>
							</code>
							<!--疾病诊断代码/疾病诊断名称-->
							<value xsi:type="CD" code="{diag/code/Value}" displayName="{diag/code/Display}" codeSystem="2.16.156.10011.2.3.3.11.3" codeSystemName="ICD-10"/>
						</observation>
					</component>
				</xsl:if>
				
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE09.00.104.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="出院西医诊断-其他诊断-入院病情代码">
							<qualifier>
								<name displayName="其他诊断-入院病情代码"/>
							</qualifier>
						</code>
						<value xsi:type="CD" code="{sickCondition/Value}" displayName="{sickCondition/Display}" codeSystem="2.16.156.10011.2.3.1.253" codeSystemName="入院病情代码表"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="Procedure/Items/ProcedureItem[1]">
		<component>
			<section>
				<code code="47519-4" displayName="HISTORY OF PROCEDURES" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
				<text/>
				<entry>
					<!-- 1..1 手术记录 -->
					<procedure classCode="PROC" moodCode="EVN">
						<code code="{code/Value}" displayName="{code/Display}" codeSystem="2.16.156.10011.2.3.3.12" codeSystemName="手术(操作)代码表(ICD-9-CM)"/>
						<statusCode/>
						<!--操作日期/时间-->
						<effectiveTime value="{procedureTime/Value}"/>
						<!--手术者-->
						<performer>
							<assignedEntity>
								<id root="2.16.156.10011.1.4" extension="医务人员编码"/>
								<assignedPerson>
									<name>
										<xsl:value-of select="procedureDoctor/Value"/>
									</name>
								</assignedPerson>
							</assignedEntity>
						</performer>
						<!--第一助手-->
						<participant typeCode="ATND">
							<participantRole classCode="ASSIGNED">
								<id root="2.16.156.10011.1.4" extension="医务人员编码"/>
								<code displayName="第一助手"/>
								<playingEntity classCode="PSN" determinerCode="INSTANCE">
									<name>
										<xsl:value-of select="primaryAssistant/Value"/>
									</name>
								</playingEntity>
							</participantRole>
						</participant>
						<!--第二助手-->
						<participant typeCode="ATND">
							<participantRole classCode="ASSIGNED">
								<id root="2.16.156.10011.1.4" extension="医务人员编码"/>
								<code displayName="第二助手"/>
								<playingEntity classCode="PSN" determinerCode="INSTANCE">
									<name>
										<xsl:value-of select="secondAssistant/Value"/>
									</name>
								</playingEntity>
							</participantRole>
						</participant>
						<entryRelationship typeCode="COMP">
							<observation classCode="OBS" moodCode="EVN">
								<code code="DE06.00.094.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="手术（操作）名称"/>
								<value xsi:type="ST">
									<xsl:value-of select="name/Value"/>
								</value>
							</observation>
						</entryRelationship>
						<!--手术级别 -->
						<entryRelationship typeCode="COMP">
							<observation classCode="OBS" moodCode="EVN">
								<code code="DE06.00.255.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="手术级别"/>
								<!--手术级别 -->
								<value xsi:type="CD" code="{procedureClass/Value}" displayName="{procedureClass/Display}" codeSystem="2.16.156.10011.2.3.1.258" codeSystemName="手术级别代码表"/>
							</observation>
						</entryRelationship>
						<!--手术切口类别 -->
						<entryRelationship typeCode="COMP">
							<observation classCode="OBS" moodCode="EVN">
								<code code="DE06.00.257.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="手术切口类别代码"/>
								<!--手术级别 -->
								<value xsi:type="CD" code="{cutLevel/Value}" displayName="{cutLevel/Display}" codeSystem="2.16.156.10011.2.3.1.256" codeSystemName="手术切口类别代码表"/>
							</observation>
						</entryRelationship>
						<!--手术切口愈合等级-->
						<entryRelationship typeCode="COMP">
							<observation classCode="OBS" moodCode="EVN">
								<code code="DE05.10.147.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="手术切口愈合等级"/>
								<!--手术切口愈合等级-->
								<value xsi:type="CD" code="{healingLevel/Value}" displayName="{healingLevel/Display}" codeSystem="2.16.156.10011.2.3.1.257" codeSystemName="手术切口愈合等级代码表"/>
							</observation>
						</entryRelationship>
						<!-- 0..1 麻醉信息 -->
						<entryRelationship typeCode="COMP">
							<observation classCode="OBS" moodCode="EVN">
								<code code="DE06.00.073.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="麻醉方式代码"/>
								<value code="{anesthesiaMethod/Value}" displayName="{anesthesiaMethod/Display}" codeSystem="2.16.156.10011.2.3.1.159" codeSystemName="麻醉方法代码表" xsi:type="CD"/>
								<performer>
									<assignedEntity>
										<id root="2.16.156.10011.1.4" extension="医务人员编码 "/>
										<assignedPerson>
											<name>
												<xsl:value-of select="anesthesiaDoctor/Value"/>
											</name>
										</assignedPerson>
									</assignedEntity>
								</performer>
							</observation>
						</entryRelationship>
					</procedure>
				</entry>
			</section>
		</component>
	</xsl:template>
	<xsl:template match="Payment">
		<component>
			<section>
				<code code="48768-6" displayName="PAYMENT SOURCES" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
				<text/>
				<!--医疗付费方式 -->
				<entry>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE07.00.007.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="医疗付款方式代码"/>
						<value xsi:type="CD" code="{paymentWay/Value}" codeSystem="2.16.156.10011.2.3.1.269" displayName="{paymentWay/Display}" codeSystemName="医疗付费方式代码表"/>
					</observation>
				</entry>
				<!--住院总费用 -->
				<entry>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.169" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="住院总费用"/>
						<value xsi:type="MO" value="{totalFee/total/Value}" currency="元"/>
						<entryRelationship typeCode="COMP" negationInd="false">
							<observation classCode="OBS" moodCode="EVN">
								<code code="HDSD00.12.170" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="住院总费用- 自付金额（元）"/>
								<value xsi:type="MO" value="{totalFee/patientPay/Amount/Value}" currency="元"/>
							</observation>
						</entryRelationship>
					</observation>
				</entry>
				<!--综合医疗服务费 -->
				<entry>
					<organizer classCode="CLUSTER" moodCode="EVN">
						<statusCode/>
						<xsl:apply-templates select="generalFee/service"/>
						<xsl:apply-templates select="generalFee/treatment"/>
						<xsl:apply-templates select="generalFee/nurse"/>
						<xsl:apply-templates select="generalFee/other"/>
					</organizer>
				</entry>
				<!--诊断类服务费 -->
				<entry>
					<organizer classCode="CLUSTER" moodCode="EVN">
						<statusCode/>
						<xsl:apply-templates select="diagFee/pathology"/>
						<xsl:apply-templates select="diagFee/lab"/>
						<xsl:apply-templates select="diagFee/image"/>
						<xsl:apply-templates select="diagFee/diagnosis"/>
					</organizer>
				</entry>
				<!--治疗类服务费 -->
				<entry>
					<organizer classCode="CLUSTER" moodCode="EVN">
						<statusCode/>
						<xsl:apply-templates select="treatmentFee/nonSurgery"/>
						<xsl:apply-templates select="treatmentFee/Surgery"/>
					</organizer>
				</entry>
				<!--康复费类服务费 -->
				<xsl:apply-templates select="rehabilitationFee"/>
				<!--中医治疗费 -->
				<entry>
					<organizer classCode="CLUSTER" moodCode="EVN">
						<statusCode/>
						<xsl:apply-templates select="TCMTreatmentFee"/>
					</organizer>
				</entry>
				<!--西药费 -->
				<xsl:apply-templates select="medicineFee"/>
				<!--中药费 -->
				<xsl:apply-templates select="TCMFee"/>
				<!-- 血液和血液制品类服务费 -->
				<xsl:apply-templates select="bloodFee"/>
				<entry>
					<observation classCode="OBS" moodCode="EVN">
						<code code="DE06.00.244.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="使用中医诊疗设备标志"/>
						<value xsi:type="BL" value="true" />
					</observation>
				</entry>
				<!-- 耗材类费用 -->
				<xsl:apply-templates select="consumableFee"/>
				<!--其他费 -->
				<xsl:apply-templates select="otherFee"/>
			</section>
		</component>
	</xsl:template>
	<xsl:template match="generalFee/service">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.174" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="综合医疗服务费-一般医疗服务费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="generalFee/treatment">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.177" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="综合医疗服 务费-一般治疗操作费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="generalFee/nurse">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.172" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="综合医疗服 务费-护理费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="generalFee/other">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.173" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="综合医疗服 务费-其他费用"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="diagFee/pathology">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.136" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="诊断-病理诊断费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="diagFee/lab">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.138" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="诊断-实验室诊断费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="diagFee/image">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.139" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="诊断-影像学诊断费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="diagFee/diagnosis">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.137" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="诊断-临床诊断项目费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="treatmentFee/nonSurgery">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.145" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="治疗-非手术治疗项目费"/>
				<value xsi:type="MO" value="{nonSurgery/Value}" currency="元"/>
				<entryRelationship typeCode="COMP">
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.146" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="治疗-非手术 治疗项目费-临床物理治疗费"/>
						<value xsi:type="MO" value="{physical/Amount/Value}" currency="元"/>
					</observation>
				</entryRelationship>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="treatmentFee/Surgery">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.147" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="治疗-手术治 疗费"/>
				<value xsi:type="MO" value="{surgery/Value}" currency="元"/>
				<entryRelationship typeCode="COMP">
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.148" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="治疗-手术治 疗费-麻醉费"/>
						<value xsi:type="MO" value="{detail/anesthesia/Value}" currency="元"/>
					</observation>
				</entryRelationship>
				<entryRelationship typeCode="COMP">
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.149" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="治疗-手术治 疗费-手术费"/>
						<value xsi:type="MO" value="{detail/surgery/Value}" currency="元"/>
					</observation>
				</entryRelationship>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="rehabilitationFee">
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.062" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="康复费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</entry>
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE06.00.243.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="使用医疗机构中药制剂标志"/>
				<value xsi:type="BL" value="true" />
			</observation>
		</entry>
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE06.00.245.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="使用中医诊疗技术标志"/>
				<value xsi:type="BL" value="true" />
			</observation>
		</entry>
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="DE06.00.180.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="辨证施护标志"/>
				<value xsi:type="BL" value="true" />
			</observation>
		</entry>
	</xsl:template>
	<xsl:template match="TCMTreatmentFee">
		<component>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.157" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="中医治疗费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</component>
	</xsl:template>
	<xsl:template match="medicineFee">
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.113" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="西药费"/>
				<value xsi:type="MO" value="12074.18" currency="元"/>
				<entryRelationship typeCode="COMP">
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.114" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="西药费-抗菌 药物费用"/>
						<value xsi:type="MO" value="{antibacterial/Value}" currency="元"/>
					</observation>
				</entryRelationship>
			</observation>
		</entry>
	</xsl:template>
	<xsl:template match="TCMFee">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.151" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="中药费-中成 药费"/>
						<value xsi:type="MO" value="{patent/Value}" currency="元"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.150" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="中药费-中草 药费"/>
						<value xsi:type="MO" value="{herb/Value}" currency="元"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="bloodFee">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.130" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="血费"/>
						<value xsi:type="MO" value="{blood/Value}" currency="元"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.126" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="白蛋白类制 品费"/>
						<value xsi:type="MO" value="{albumin/Value}" currency="元"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.128" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="球蛋白类制 品费"/>
						<value xsi:type="MO" value="{globulin/Value}" currency="元"/>
					</observation>
				</component>
				<!-- 凝血因子类制品费 -->
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.127" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="凝血因子类 制品费"/>
						<value xsi:type="MO" value="{clotfactor/Value}" currency="元"/>
					</observation>
				</component>
				<!--细胞因子类制品费 -->
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.129" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="细胞因子类 制品费"/>
						<value xsi:type="MO" value="{cellfactor/Value}" currency="元"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="consumableFee">
		<entry>
			<organizer classCode="CLUSTER" moodCode="EVN">
				<statusCode/>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.045" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="一次性医用 材料费-检查用"/>
						<value xsi:type="MO" value="{exam/Value}" currency="元"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.047" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="一次性医用 材料费-治疗用"/>
						<value xsi:type="MO" value="{treatment/Value}" currency="元"/>
					</observation>
				</component>
				<component>
					<observation classCode="OBS" moodCode="EVN">
						<code code="HDSD00.12.046" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="一次性医用 材料费-手术用"/>
						<value xsi:type="MO" value="{surgery/Value}" currency="元"/>
					</observation>
				</component>
			</organizer>
		</entry>
	</xsl:template>
	<xsl:template match="otherFee">
		<entry>
			<observation classCode="OBS" moodCode="EVN">
				<code code="HDSD00.12.092" codeSystem="2.16.156.10011.2.2.4" codeSystemName="住院病案首页基本数据集" displayName="其他费"/>
				<value xsi:type="MO" value="{Value}" currency="元"/>
			</observation>
		</entry>
	</xsl:template>
</xsl:stylesheet>
